class Shezhi extends Scene{
	private kg:egret.TextField;
	private kg1:egret.TextField;
	public constructor() {
		super();
		this.width = 400;
		this.height = 400;
		this.addEventListener("gbyl",this.onmove,this);
	}
	protected onadd(){
		let tck:egret.Shape = new egret.Shape();
		tck.graphics.beginFill(0x000000,0.5);
		tck.graphics.drawRect(0,0,this.width,this.height);
		tck.graphics.endFill();
		this.addChild(tck);

		let Yy:egret.TextField = new egret.TextField();
		this.addChild(Yy);
		Yy.text = '音乐:';
		Yy.x = 50;
		Yy.y = 70;

		this.kg = this.shezhi((SoundManager.Instance.isMusic?"开":"关"),150,70,80,40,0x000000,true,this.onkaiguan);
		this.addChild(this.kg);
		
		let Yx:egret.TextField = new egret.TextField();
		this.addChild(Yx);
		Yx.text = '音效:';
		Yx.x = 50;
		Yx.y = 150;

		this.kg1 = this.shezhi((SoundManager.Instance.isEffect?"开":"关"),150,150,80,40,0x000000,true,this.onkaiguan1);
		this.addChild(this.kg1);

		let YL:egret.TextField = new egret.TextField();
		this.addChild(YL);
		YL.text = '音量';
		YL.x = 50;
		YL.y = 280;

		let sl:Slider = new Slider(200,SoundManager.Instance.isvolume);
		this.addChild(sl);
		sl.x = 150;
		sl.y = 290;

		let guanbi = this.shezhi('X',this.width-30,0,30,30,0x786523,true,this.guanbi);
		this.addChild(guanbi);

	}
	protected onRemove(){

	}
	private onkaiguan(){
		if(SoundManager.Instance.isMusic){
			SoundManager.Instance.isMusic = false;
			this.kg.text = "关";
		}else{
			SoundManager.Instance.isMusic = true;
			this.kg.text = '开';
		}
		
	}
	private onkaiguan1(){
		if(SoundManager.Instance.isEffect){
			SoundManager.Instance.isEffect = false;
			this.kg1.text = "关";
		}else{
			SoundManager.Instance.isEffect = true;
			this.kg1.text = '开';
		}
	}
	private guanbi(){
		SceneManager.getInstance().popScene();
	}
	private onmove(e:egret.Event){
		SoundManager.Instance.isvolume = e.data;
		// SoundManager.Instance.setVolume(e.data);
	}
}